package com.xinxin.siteset.controller;


import com.xinxin.siteset.model.Site;
import com.xinxin.siteset.service.SiteService;
import com.xinxin.siteset.utils.ResponseUtil;
import com.xinxin.siteset.vo.Response;
import com.xinxin.siteset.vo.SiteParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 史鑫鑫
 * @date Created in 2019/6/7 3:01
 */
@RestController
@RequestMapping("/v1/api")
public class SiteController {
    @Autowired
    SiteService siteService;

    @PostMapping("/sites")
    public Response allclassification(@RequestBody SiteParam siteParam) {
        Site site = new Site();
        site.setClassificationId(siteParam.getClassificationId());
        site.setSiteUrl(siteParam.getSiteUrl());
        site.setSiteName(siteParam.getSiteName());
        site.setSiteTitle(siteParam.getSiteTitle());
        siteService.insert(site);
        return ResponseUtil.success();
    }
}
